package com.lwl.office.dcconverter.element;

import com.lwl.office.webeditor.ParserContext;
import lombok.Data;


/**
 * 表格行
 */
@Data
public class DCTableRow extends AbsDCElement{
    public DCTableCell addCell(){
        DCTableCell dctc = new DCTableCell();
        addChild(dctc);
        return dctc;
    }

    @Override
    public String toHtml() {
        StringBuilder stb = new StringBuilder();
        stb.append("<tr");
        //第一行
        if(getParent().getChildren().get(0) == this){
            stb.append(" class=\"firstRow\">");
        }else{
            stb.append(">");
        }
        for (AbsDCElement cell : getChildren()) {
            stb.append(cell.toHtml());
        }
        stb.append("</tr>");
        return stb.toString();
    }

    @Override
    public void parseWord(ParserContext context) {

    }
}
